<div class="content-box"><!-- Start Content Box -->
    <div class="content-box-header">

        <h3>Slide</h3>

        <ul class="content-box-tabs">

            <li><a href="index.php?page=lienket">Table</a></li> <!-- href must be unique and match the id of target div -->
            <li><a href="#tab2" class="default-tab">Forms</a></li>
        </ul>

        <div class="clear"></div>

    </div> <!-- End .content-box-header -->

    <div class="content-box-content">



        <div class="content-box-tabs" id="tab2">        <div class="bot"></div>
    <div class="contentt">
        	<div class="pop" style="width: 1015px;background-color:#f5f5f5;padding-top:20px;height:170px">
<?php
$hide_show=1;
$ten='';$anh='';$txt_link='';$caption='';
if(isset($_POST['txt_link']))	
	{
		$txt_link=$_POST['txt_link'];
		$hide_show=0;
	}
	if(isset($_POST['anh']))		$anh=$_POST['anh'];
	if(isset($_POST['caption']))	$caption=$_POST['caption'];
	if($hide_show==1)
	{
?>
    <form  name="frnn" action="" method="post" enctype="multipart/form-data">
        <div class="modal-header" style="margin-bottom: 20px;">
            <h3 style="text-align: center;font-size:24px;color:#C00" id="myModalLabel">Thêm ảnh slide</h3>
        </div>
        <div style="height: 45px;">
        <center>
            <input type="file" name="anh">
            <input name="txt_link" id="txt_link"  value=""  placeholder="Thêm link slideshow" type="text" maxlength="255" >
            <input name="caption" id="caption"  value=""  placeholder="Thêm caption" type="text" maxlength="255" >
            <br><br>
            </center>
        </div>
        <div class="">
            <div style="margin: auto;">
            <center>
                <button class="btn" type="reset">Nhập lại</button>
                <button class="btn" type="submit" name="submit" 
                	style="width:100px; background:#0066FF; border:none; height:22px; color:#FFFFFF; border-radius:2px; cursor:pointer">Thêm</button>
            </center>
            </div>
        </div>
    </form>
    <?php
	}else
	{
		//Define some variables  
$dir = "../js/data1/images/"; //Bạn nên thay đổi đường dẫn cho phù hợp
//Kiều file, Gif, jpeg, zip ::bạn có thể sửa đổi nếu thích 
$types = array("image/gif","image/GIF","image/JPG","image/PNG","image/png","image/jpg","image/JPEG","image/jpeg","application/x-zip-compressed","application/msword","application/vnd.ms-excel");     
//Check to determine if the submit button has been pressed  
if(isset($_POST["submit"])){ 
//Shorten Variables  
     $tmp_name = $_FILES["anh"]["tmp_name"];  
     $new_name = $_FILES["anh"]["name"]; 
//Check MIME Type  
    if (in_array($_FILES["anh"]["type"], $types)){                     
         //Move file from tmp dir to new location  
        move_uploaded_file($tmp_name,$dir . $new_name);    
		$anh=$new_name;        
        echo "<script>alert('File {$_FILES["anh"]["name"]} đã gửi xong!');</script>"; 
    }else{                 
    //Print Error Message  
     echo "<script>alert('{$_FILES["anh"]["name"]} upload file thất bại !');</script>";       
    //Debug  
    }       
    }       
else{       
    echo 'Không có file upload';   
}  
		
				$sql3_1="INSERT INTO `tbl_slide`(`image`,`link`,`caption`) VALUES ('".$anh."','".$txt_link."','".$caption."')";
				$res3_1=mysql_query($sql3_1);
		if(isset($sql3_1))
		{
			?>
            <script>alert('Thêm Thành Công ! ');</script>
            <?php
			header('refresh:1; index.php?page=slide');
		}
		if(!isset($sql3_1))
		{
			?>
            <script>alert('Thêm Thất bại ! ');</script>
            <?php
		}
	}
	?>

                </div>
            </div>
        </div>
    </div>
</div>